package org.dr.springmvcdemo.streamAPI;



import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class StreamExample {
    public static void main(String[] args) {
        List<String> fruits = Arrays.asList("apple", "banana", "cherry", "dates", "elderberry");

        // 找出长度大于5的水果并转换为大写
        List<String> result = fruits.stream()
                .filter(fruit -> fruit.length() > 5)
                .map(String::toUpperCase)
                .collect(Collectors.toList());

        System.out.println("Filtered and mapped fruits: " + result);
    }
}

